﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ProjectMain
{
    public partial class FrmMain : Form
    {
        ProjectCommon.ClassCommon cc;
        public FrmMain(ProjectCommon.ClassCommon aClassCommon)
        {
            InitializeComponent();
            cc = aClassCommon;            
        }


        private void button1_Click(object sender, EventArgs e)
        {
            ProjectTask.FrmTaskList ptftl = new ProjectTask.FrmTaskList(cc);
            this.Hide();
            ptftl.ShowDialog();
            this.Show();
            ptftl.Dispose();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            ProjectShop.FrmShopList psfsl = new ProjectShop.FrmShopList(cc);
            this.Hide();
            psfsl.ShowDialog();
            this.Show();
            psfsl.Dispose();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void FrmMain_Shown(object sender, EventArgs e)
        {
            string sPowerRight = cc.dtLoginUser.Rows[0]["PowerRight"].ToString();
            btnTask.Enabled =ProjectCommon.ClassCommon.SetPowerRight(sPowerRight[0]);
            btnShop.Enabled = ProjectCommon.ClassCommon.SetPowerRight(sPowerRight[1]);
        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            FrmModifyPassword fmp = new FrmModifyPassword(cc);
            fmp.ShowDialog();
            fmp.Dispose();
        }
    }
}
